//
//  DDDeleteFile.m
//  MyClouds
//
//  Created by sarah doo on 13-8-11.
//  Copyright (c) 2013年 sarah doo. All rights reserved.
//

#import "DDDeleteFile.h"

@implementation DDDeleteFile



- (id)initWithData:(NSData *)data {
    self = [super initWithData:data];
    return self;
}

- (id)initWithUid:(int)uid {
    self = [self init];
    NSData* uidData = [self intToData:uid];
    NSRange range;
    range.location = HEADER_LENGTH;
    range.length = INT_SIZE;
    [entity replaceBytesInRange:range withBytes:[uidData bytes]];
    
    int crc = [self crcs:entity withLength:[entity length]];
    [self setCrc:crc];
    return self;
}

- (int)getDeleteId{
    int uid = -1;
    NSRange range;
    range.location = HEADER_LENGTH;
    range.length = INT_SIZE;
    uid = [self dataToInt:[entity subdataWithRange:range]];
    return uid;
}
@end
